import {Component} from "../../anno/Component"
import {Order} from "../../anno/Order"
import {ReturnValueHandler} from "../../../web/_ReturnValueHandler"

@Component()
@Order(-1)
class StringHandler extends ReturnValueHandler {
  canWrite(value: any): boolean {
    return typeof value === "string";
  }

  write(req: HttpRequest, res: HttpResponse, value: any): void {
    res.end(value)
  }

}
